package org.lilred.nzbberry.views;


import org.lilred.nzbberry.config.Resizer;
import org.lilred.nzbberry.util.FontFactory;
import org.lilred.ui.theme.Texture;
import org.lilred.ui.theme.ThemeOld;
import org.lilred.ui.theme.ThemeSetting;
import net.rim.device.api.ui.container.MainScreen;

public class AppView extends MainScreen {
	private static AppView INSTANCE;

	public static AppView getInstance() {
		if (INSTANCE == null) INSTANCE = new AppView();
		return INSTANCE;
	}

	public AppManager appManager;
	public ThemeOld themeOld;
		
	public AppView() {
		super(NO_VERTICAL_SCROLL | USE_ALL_HEIGHT | USE_ALL_WIDTH);
		setFont(FontFactory.getFont(Resizer.resize(20)));
		appManager = new AppManager(true);
		add(appManager);
		initializeTheme();
		INSTANCE = this;
	}
	
	private void initializeTheme() {
		ThemeSetting clickableDefault = new ThemeSetting(0x292c29, 0x292c29, 0xFFFFFF, 0x888888, Texture.GLASS, 60);
		ThemeSetting clickableHover = new ThemeSetting(0xFFFF00, 0x999999, 0x292c29, 0x888888, Texture.GLASS, 60);
		ThemeSetting clickableActive = new ThemeSetting(0xb5b2b5, 0xb5b2b5, 0x000000, 0x888888, Texture.GLASS, 60);
		ThemeSetting content = new ThemeSetting(0xdedfde, 0xb5b2b5, 0x000000, 0x888888, null, 125);
		ThemeSetting inputDefault = new ThemeSetting(0xFFFFFF, 0xb5b2b5, 0x000000, 0x000000, null, 125);
		ThemeSetting inputHover = new ThemeSetting(0xFFFFFF, 0xFFFF00, 0x000000, 0x000000, null, 125);
		themeOld = new ThemeOld();
		themeOld.themeSettings[ThemeOld.CLICKABLE_DEFAULT] = clickableDefault;
		themeOld.themeSettings[ThemeOld.CLICKABLE_HOVER]= clickableHover;
		themeOld.themeSettings[ThemeOld.CLICKABLE_ACTIVE] = clickableActive;
		themeOld.themeSettings[ThemeOld.CONTENT] = content;
		themeOld.themeSettings[ThemeOld.INPUT_HOVER] = inputHover;
		themeOld.themeSettings[ThemeOld.INPUT_DEFAULT] = inputDefault; 
	}
	
	protected boolean onSavePrompt() {
		return true;
	}
}
